package com.guocheng.modules.meet.utils;

import com.guocheng.modules.meet.model.po.Meet;
import com.guocheng.utils.DateUtil;

import java.util.Date;

public class MeetUtils {

    public static Meet init(Meet meet) {
        //开始时间
        Date startTime = DateUtil.strToDateT(meet.getStartTimeStr());
        meet.setStartTime(startTime);
        //结束时间
        Date endTime = DateUtil.strToDateT(meet.getEndTimeStr());
        meet.setEndTime(endTime);

        //时间区间是否正确
        if (startTime.after(endTime)) return null;

        //会议时间是否正确
        Date nowDate = new Date();
        if (nowDate.after(endTime)) return null;

        //初始状态判断
        meet.setStatus(nowDate.after(startTime) ? 2 : 1);

        return meet;
    }
}
